ROICash Flow Entry
Represents a single cash flow entry used in Internal Rate of Return (IRR), or Return on Investment (ROI) calculations.
Each entry records the cash flow amount, its date, and the number of years between the cash flow and the start of the reporting period. The cash flow should represent a deposit or withdrawal
reinvested investment income (back into shares) - e.g. DIVIDEND_REINVEST - should typically be excluded as this will be reflected in the share balance of the security account anyway.
Sign Convention
Moneydance uses a standard financial convention:
Positive values = cash outflows (e.g. investments - e.g. buy, exp),
Negative values = cash inflows (e.g. proceeds - i.e. sell, div, inc), This aligns with discounted cash flow conventions and does not affect result validity (i.e. you could reverse all the signs and get the same result)
Note: As this object is mutable (i.e. by calling setStartDate) you should use clone if you require multiple copies of this cash flow.
Cashflow entries can be either a transaction or a total amount (account balance).
Parameters
The entry's date.
The entry's value as a long, already expressed in terms of the destination currency investCurr.
Currency to use (e.g. dollars, euro, etc., not shares).
The start of the reporting period. This can be changed later by calling setStartDate and it will recalculate annumsInPeriod on all entries.
The transaction type that generated this cash flow entry (optional, can be null)
Constructors
Cashflow entries constructor. Simple version with no transaction type or source. Refer main constructor for details of parameters. (compatibility with the pre-MD2027 constructor for any java / api usage)
Constructor from a security transaction (automatically determines the txnType and source settings).
Functions
The number of days from the cash flows start date to this entry's date (inclusive), divided by 365
Returns a clone of this cashflow (containing copies of the data fields).
Returns a clone of this cashflow whilst also converting the currency and value(s) (all other fields are copied). Note: This currency conversion can either use the existing cash flow entry's dateInt (default) - i.e. include FX impact in IRR, or the optional toDate parameter when excluding FX impacts - i.e. constant currency / exclude FX impact in IRR.
Define the start date for the cash flow(s) and compute/recompute the number of years from the start date to this entry's date (inclusive). Even though they are invalid, this method tolerates starting dates that are after the cash flow entry date to ensure that the number of years is always positive, since it is passed into Math.pow().